<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5><i class="fa fa-home"></i> 客户汇总列表</h5>
          <div class="ibox-tools"><a href="?">
            <button type="button" class="btn btn-xs btn-danger"> <i class="fa fa-refresh"></i>刷新</button>
            </a> </div>
        </div>
        <div class="ibox-content table-responsive">
          <div class="row">
            <form id="pagerForm" method="post" class="form-inline">
              <div class="col-sm-3 m-b-xs"> 
				  		<a class="btn btn-info single_operation" data-act="add" href="javascript:void(0)"><i class="fa fa-plus"></i>添加</a>
                <div class="btn-group">
                  <button data-toggle="dropdown" class="btn btn-default dropdown-toggle">批量操作 <span class="caret"></span></button>
                  <ul class="dropdown-menu">
                    <li><a href="javascript:void(0)" class="batch_operation" data-act="export">批量导出</a></li>
                    <li class="divider"></li>
                    <li><a href="javascript:void(0)" class="batch_operation" data-act="delete">批量删除</a></li>
                  </ul>
                </div>
              </div>
              <div class="col-sm-9 m-b-xs text-right">
				  		 录入日期：
				  		<div class="input-group pd-b-5">
                  <input type="text" name="create_date_b" class="form-control datepicker" style="width: 100px;">
				  		</div>
						<div class="input-group pd-b-5">
						<input type="text" name="create_date_e" class="form-control datepicker" style="width: 100px;">
						</div>				  		
                <div class="input-group">
                  <span class="input-group-btn">
                  <button type="button" class="btn btn-primary ajaxSearchForm"><i class="fa fa-search"></i> 搜索</button>
                  </span> </div>
              </div>
            </form>
          </div>
          <table class="table table-hover sorttable 07fly-table" width="100%">
            <thead>
              <tr>
                <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				  		<th width="150"><span>销售人员</span></th>
				  		<th width="100" orderField="by_total_num" class="sort-filed"><span>累计客户数</span></th>
				  		<th width="100" orderField="by_total_money" class="sort-filed"><span>累计消费</span></th>
				  		<th width="100" orderField="by_total_money_cost" class="sort-filed"><span>累计成本</span></th>
				  		<th width="100" orderField="by_total_integral" class="sort-filed"><span>累计积分</span></th>
				  		<th width="100" orderField="by_total_cash" class="sort-filed"><span>现金券余额</span></th>
				  		<th width="100"><span>毛利</span></th>
              </tr>
            </thead>
            <tbody>
            </tbody>
          </table>
			  <table class="table 07fly-table"><tfoot class="ibox-content"><tr><td align="center" class="pagestring"></td></tr></tfoot></table>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>
<script id="tableListTpl" type="text/html">
<% 
for(var i=0;i<list.length;i++) { 

list[i]=null2zero(list[i]);
%>

	<tr>
		<td><input name="record_id" class="checkboxCtrlId" value="<%=list[i]['record_id']%>" type="checkbox"></td>
		<td><%=list[i]['name']%></td>
		<td><%=list[i]['total_num']%></td>
		<td><%=Number(list[i]['c_total_money'])%></td>
		<td><%=Number(list[i]['c_total_money_cost'])%></td>
		<td><%=Number(list[i]['c_total_integral'])%></td>
		<td><%=Number(list[i]['c_total_cash'])%></td>
		<td><%=Number(list[i]['c_total_money'])-Number(list[i]['c_total_money_cost'])%></td>
	</tr>
<% } %>
	<tr style="color:#f00;">
		<td></td>
		<td>小计</td>
		<td><%=moneyRs['total_num']%></td>
		<td><%=Number(moneyRs['c_total_money'])%></td>
		<td><%=Number(moneyRs['c_total_money_cost'])%></td>
		<td><%=Number(moneyRs['c_total_integral'])%></td>
		<td><%=Number(moneyRs['c_total_cash'])%></td>
		<td><%=Number(moneyRs['c_total_money'])-Number(moneyRs['c_total_money_cost'])%></td>

	</tr>
</script>
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script>
<script type="text/javascript">
var ajaxUrl='#{$smarty.const.ACT}#/erp/ChartCustomer/chart_customer_json/';
$(document).ready(function () {
	$('.chosen-select').chosen({search_contains: true});
	$('.chosen-select').chosen().change(function(){
		ajaxSearchFormData = $("form").serialize();
		turnPage(1);
	});	 
	turnPage(1);//页面加载时初始化分页
});
</script>